const files = require.context('../views/detail', false, /\.vue$/);
const pages = {};

files.keys().forEach((key) => {
    ///3、通过正则将文件名作为属性名来保存文件
    pages[key.replace(/(\.\/|\.vue)/g, '')] = files(key).default;
});

let routesL = [];
// 通过内置对象Object的keys方法来生成vue可用的路由数组
Object.keys(pages).forEach((item) => {
    let name = item.split('-')[1]
    routesL.push({
        path: `/${name}`,
        name: name,
        component: pages[item],
    });
});
export default routesL;
